classes.layers.Intro = cc.Layer.extend({
    isMouseDown:false,
    helloImg:null,
    helloLabel:null,
    sprite:null,
    alabel:null,
    playerName:'kelsey',
    init:function () {
        var selfPointer = this;
        //////////////////////////////
        // 1. super init first
        this._super();

        /////////////////////////////
        // 2. add a menu item with "X" image, which is clicked to quit the program
        //    you may modify it.
        // ask director the window size
        var size = cc.Director.getInstance().getWinSize();

        // add a "close" icon to exit the progress. it's an autorelease object
        var menuItem = new cc.MenuItemFont.create("Play",this.startGame,this);
        menuItem.setFontName('PressStart2P');

        var menu = cc.Menu.create(menuItem);
        menu.setPosition(cc.PointZero());
        this.addChild(menu, 1);
        menuItem.setPosition(cc.p(size.width/2, 60));

        var kelsey = new cc.MenuItemImage.create('res/kelsey_menu.png', 'res/kelsey_menu_selected.png', this.setPlayerKelsey, this),
        brad = new cc.MenuItemImage.create('res/brad_menu.png', 'res/brad_menu_selected.png', this.setPlayerBrad, this),
        will = new cc.MenuItemImage.create('res/will_menu.png', 'res/will_menu_selected.png', this.setPlayerWill, this);
        var m = new cc.Menu.create(kelsey,brad,will);
        m.setPosition(cc.PointZero());
        this.addChild(m,1);
        kelsey.setPosition(cc.p(109, size.height/2));
        brad.setPosition(cc.p(110, size.height/2 - 50));
        will.setPosition(cc.p(110, size.height/2 - 100));

        /////////////////////////////
        // 3. add your codes below...
        // add a label shows "Hello World"
        // create and initialize a label
        this.helloLabel = cc.LabelTTF.create("Intern Adventure", "PressStart2P", 24);
        // position the label on the center of the screen
        this.helloLabel.setPosition(cc.p(size.width / 2, 0));
        // add the label as a child to this layer
        this.addChild(this.helloLabel, 5);

        this.alabel = cc.LabelTTF.create("GET THE CODE THROUGH VALIDATION", "PressStart2P", 14);
        // position the label on the center of the screen
        this.alabel.setPosition(cc.p(size.width / 2, 30));
        // add the label as a child to this layer
        this.addChild(this.alabel, 6);

        var lazyLayer = cc.Layer.create();
        this.addChild(lazyLayer);

        // add "HelloWorld" splash screen"
        this.sprite = cc.Sprite.create("res/riha-devil2.png");
        this.sprite.setPosition(cc.p(size.width / 2, size.height / 2));
        this.sprite.setScale(0.5);
        this.sprite.setRotation(180);

        lazyLayer.addChild(this.sprite, 0);

        var rotateToA = cc.RotateTo.create(2, 0);
        var scaleToA = cc.ScaleTo.create(2, 1, 1);

        this.sprite.runAction(cc.Sequence.create(rotateToA, scaleToA));

        this.helloLabel.runAction(cc.Spawn.create(cc.MoveBy.create(2.5, cc.p(0, size.height - 40)),cc.TintTo.create(2.5,255,125,0)));

        this.setTouchEnabled(true);
        return true;
    },
    // a selector callback
    startGame: function(sender) {
        console.log("called");
        cc.Director.getInstance().pushScene(new classes.scenes.Game(this.playerName));
    },
    onTouchesBegan:function (touches, event) {
        this.isMouseDown = true;
    },
    onTouchesEnded:function (touches, event) {
        this.isMouseDown = false;
    },
    onTouchesCancelled:function (touches, event) {
        console.log("onTouchesCancelled");
    },
    setPlayerKelsey: function(sender) {
        this.playerName = 'kelsey';
    },
    setPlayerBrad: function(sender) {
        this.playerName = 'brad';
    },
    setPlayerWill: function(sender) {
        this.playerName = 'will';
    }
});